// /////////////////////////////////////////////////////////////////////////////
//
// Name:            components.cpp
// Author:          Michael Bartsch (ZCCdark203)
//
// Desc :           Implements global functions regarding components.
//
// License:         Copyright (C) 2009 Michael Bartsch and Contributors
//
//                  This program is free software: you can redistribute it
//                  and/or modify it under the terms of the zlib/libpng License.
//                  See main.cpp for conditions of distribution and use.
//
// /////////////////////////////////////////////////////////////////////////////

// Include files
#include "components.h"

// Creates a component of the given type.
EntityComponent* createComponent(const std::string &type, Entity *parent)
{
    // scene
         if(type == "AnimatedMeshComponent")    return new AnimatedMeshComponent(parent);
    else if(type == "BillboardComponent")       return new BillboardComponent(parent);
    else if(type == "CameraComponent")          return new CameraComponent(parent);
    else if(type == "ImageComponent")           return new ImageComponent(parent);
    else if(type == "LightComponent")           return new LightComponent(parent);
    else if(type == "MeshComponent")            return new MeshComponent(parent);
    else if(type == "OctTreeComponent")         return new OctTreeComponent(parent);
    else if(type == "ParticleSysComponent")     return new ParticleSysComponent(parent);
    else if(type == "SkyBoxComponent")          return new SkyBoxComponent(parent);
    else if(type == "SkyDomeComponent")         return new SkyDomeComponent(parent);
    else if(type == "TerrainComponent")         return new TerrainComponent(parent);
    else if(type == "TextBillboardComponent")   return new TextBillboardComponent(parent);

    // sound
    else if(type == "SoundListenerComponent")   return new SoundListenerComponent(parent);
    else if(type == "SoundSourceComponent")     return new SoundSourceComponent(parent);

    // We couldn't find the requested component.
    return NULL;
}

// End of File
